<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head>
	<title>用户登陆</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="{:__TMPLPUB__}/Css/style.css" />
	<script type="text/javascript" src="{:_PUBLIC_}/Js/jquery.js"></script>
</head>
<body onLoad="login_form.user_name.focus()" id="body-login" >
	 <div id="login">
		<h3 class="login-header">用户登陆</h3>
		<h1 class="login-logo">OpenForEveryone</h1>
		<form action="{:Dyhb::U('user/check_login')}" method="post" id="login_form">
			<fieldset class="none" id="ajax_box">
				<div><img id="ajaximg" />&nbsp;&nbsp;&nbsp;<p id="ajaxcontent"></p></div>
			</fieldset>
			<fieldset>
				<label for="user_name">用户名</label>
				<input type="text" name="user_name" id="user_name" />
			</fieldset>
			<fieldset>
				<label for="user_password">密码</label>
				<input type="password" name="user_password" id="user_password"/>
			</fieldset>
			{if $GLOBALS['___config___']['login_code']=='y'}
			<fieldset>
				<label for="user_string">验证码</label>
				<input type="text" name="user_string" id="user_string" />
			</fieldset>
			{/if}
			<div class="login-bottom">
				<input value="返回首页" type="button" onClick="location.href='{:__ROOT__}';" />
				<input type="button" name="login_sub" id="login_sub" value="登陆" />
			</div>
		</form>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#login_sub").click(function(){
				var data=$("form").serialize();
				$("#ajaximg").attr("src","{:_PUBLIC_}/Images/ajax/loading.gif");
				$("#ajaxcontent").html("正在登陆中,请稍等...");
				$("#ajax_box").css("background","white");
				$("#ajax_box").css("display","block");
				$.post("{:Dyhb::U('user/check_login')}",data,function(result){
					if(result==1){
						$("#ajaximg").attr("src","{:_PUBLIC_}/Images/ajax/ok.gif");
						$("#ajaxcontent").html("登陆成功");
						window.location.href="{:Dyhb::U('index/index')}";
					}else if(result==0){
						$("#ajaximg").attr("src","{:_PUBLIC_}/Images/ajax/update.gif");
						$("#ajaxcontent").html("用户名或密码错误");
						setTimeout(function(){
							$("#ajax_box").css("display","none");
						},2000);
					}
				});
			});
		});
	</script>
</body>
</html>